import fetch from 'utils/fetch';

export function loginByEmail(phone, password) {
  const data = {
    phone,
    password
  };
  return fetch({
    url: '/auth/token',
    headers: {'Content-type': 'application/json;charset=UTF-8'},
    method: 'post',
    data
  });
}

export function logout() {
return fetch({
    url: '/jwt/invalid',
    method: 'post'
});
}

export function getInfo(token) {
  return fetch({
//  url: '/api' +'/admin/api/user/username/' + localStorage.getItem('access-userId'),
//		url:'/api' +'/admin/api/user/un/' + localStorage.getItem('access-userId') + '/permissions',
		url:'/auth/user',
    method: 'get',
    data: token
  });
}

export function getUserType(userId) {
  return fetch({
		url:'api/admin/group/getUserIdSelectRoleType/' + userId,
    method: 'get',
    // data: token
  });
}